package com.jh.paymentchannel.pojo;

import cn.jh.common.utils.CommonConstants;

import java.io.Serializable;

public class BaseResponse implements Serializable {

    private String resp_code;

    private String resp_message;

    private Object result;

    public String getResp_code() {
        return resp_code;
    }

    public void setResp_code(String resp_code) {
        this.resp_code = resp_code;
    }

    public String getResp_message() {
        return resp_message;
    }

    public void setResp_message(String resp_message) {
        this.resp_message = resp_message;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public static BaseResponse successResult(Object result){
        BaseResponse baseResponse = new BaseResponse();
        baseResponse.setResp_code(CommonConstants.SUCCESS);
        baseResponse.setResp_message("成功");
        baseResponse.setResult(result);
        return baseResponse;
    }

    public static BaseResponse successMsg(String msg){
        BaseResponse baseResponse = new BaseResponse();
        baseResponse.setResp_code(CommonConstants.SUCCESS);
        baseResponse.setResp_message(msg);
        return baseResponse;
    }

    public static BaseResponse success(String msg,Object result){
        BaseResponse baseResponse = new BaseResponse();
        baseResponse.setResp_code(CommonConstants.SUCCESS);
        baseResponse.setResp_message(msg);
        baseResponse.setResult(result);
        return baseResponse;
    }

    public static BaseResponse serviceError(String msg){
        BaseResponse baseResponse = new BaseResponse();
        baseResponse.setResp_code(CommonConstants.FALIED);
        baseResponse.setResp_message(msg);
        return baseResponse;
    }
    public static BaseResponse error(String resp_code,String msg){
        BaseResponse baseResponse = new BaseResponse();
        baseResponse.setResp_code(resp_code);
        baseResponse.setResp_message(msg);
        return baseResponse;
    }
}
